﻿<%@ Page Title="My Request" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="MyRequest.aspx.cs" Inherits="SAP.MyRequest" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        Main.myUpdatePanelId = '<%= SalesOpportunityUpdatePanel.ClientID %>';

        function printPage(type, regID) {
            if (type == "P")
                javascript: Main.openDialog('../Report/Popup_RequisitionPurchase.aspx?requestID=' + regID); 
            else
                javascript: Main.openDialog('../Report/Popup_RequisitionGeneral.aspx?requestID=' + regID);
        }

        function showConfirmMessage() {
            //
            return confirm('Are you sure you want to submit this requisition?');
        }
    </script>
    <asp:UpdatePanel ID="SalesOpportunityUpdatePanel" runat="server">
        <ContentTemplate>
            <div id="contentData" style="padding-left: 15px;">
                <div id="title-form" style="border-bottom: 2px solid black;">
                    <h2 style="font-size: small">MY REQUEST</h2>
                </div>
                <div id="header-form">
                    <div style="width: 418px; height: 41px;">
                        <table >
                            <tr>
                                <td class="detail_table_td_100" style="width: 74px">
                                    <span>From Date</span>
                                </td>
                                <td style="width: 170px">
                                    <asp:TextBox ID="txtFromDate" runat="server" class="txtDate" Width="120px"></asp:TextBox>
                                </td>
                                <td class="detail_table_td_100" style="width: 72px">
                                    <span>To Date</span>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtToDate" runat="server"  class="txtDate" Width="120px" ></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="detail_table_td_100" style="width: 74px">
                                    <span>Status</span>
                                </td>
                                <td style="width: 170px">
                                    <asp:DropDownList ID="ddlType" runat="server" Width="120px">
                                        <asp:ListItem Text="All" Value="-1"></asp:ListItem>
                                        <asp:ListItem Text="Rejected" Value="0"></asp:ListItem>
                                        <asp:ListItem Text="Approved" Value="1"></asp:ListItem>
                                        <asp:ListItem Text="Pending" Value="2"></asp:ListItem>
                                        <asp:ListItem Text="Draft" Value="3"></asp:ListItem>
                                       <%-- <asp:ListItem Text="Posted to SAP" Value="3"></asp:ListItem>--%>
                                    </asp:DropDownList>
                                    
                                </td>
                                <td>
                                    <asp:ImageButton ID="ib_Filter" runat="server" 
                                        ImageUrl="~/skin/images/SAP_Filter.png" onclick="ib_Filter_Click" />
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <br />
                <br />
                <div ID="tabs-1" style="overflow: auto; height: 497px; margin-top: 0px;">
                    <asp:ListView ID="lvStage" runat="server" onitemcommand="lvStage_ItemCommand" OnLayoutCreated="OnLayoutCreated"
                        OnItemEditing="lvStage_ItemEditing">
                        <LayoutTemplate>
                            <table class="data_table">
                                <tr>
                                    <th style="width: 80px">
                                        <span>Request ID</span>
                                    </th>
                                    <th style="width: 70px">
                                        <span>Requester</span>
                                    </th>
                                    <th style="width: 100px">
                                        <span>Request Name</span>
                                    </th>
                                    <th style="width: 90px">
                                        <span>Request Type</span>
                                    </th>
                                    <th style="width: 100px">
                                        <span>Posting Date</span>
                                    </th>
                                    <th style="width: 100px">
                                        <span>Valid Until</span>
                                    </th>
                                    <th style="width: 100px">
                                        <span>Request Date</span>
                                    </th>
                                    
                                    <th style="width: 60px">
                                        <span>Edit</span>
                                    </th>

                                    <th style="width: 70px">
                                        <span>Submit</span>
                                    </th>

                                     

                                     <th style="display:none">
                                        <span>Status</span>
                                    </th>
                                   <th style="width: 100px">
                                        <span>Status</span>
                                    </th>
                                    <th style="width: 70px">
                                        <span>View</span>
                                    </th>

                                    <th style="width: 70px">
                                        <span>Print</span>
                                    </th>
                                </tr>
                                <tr ID="itemPlaceholder" runat="server">
                                </tr>
                            </table>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <tr>
                            <td >
                                    <asp:Label ID="HdrID" runat="server"><%#Eval("hdrID")%></asp:Label>
                                </td>
                                <td style="text-align: left" style="display: none">
                                    <asp:Label ID="Requester"  runat="server"><%#Eval("Requester")%></asp:Label>
                                </td>

                                <td style="text-align: left">
                                    <asp:Label ID="ReqName" runat="server"><%#Eval("ReqName")%></asp:Label>
                                </td>

                                 <td style="text-align: left">
                                    <asp:Label ID="ReqType" runat="server"><%#Eval("ReqType", "") == "F" ? "Food" : (Eval("ReqType", "") == "B" ? "Beverage" : ((Eval("ReqType", "") == "P" ? "Purchase" : "Food Transfer")))%></asp:Label>
                                </td>

                                <td>
                                    <asp:Label ID="DocDate" runat="server"><%#Eval("DocDate", "{0:dd/MM/yyyy}")%></asp:Label>
                                </td>
                                 <td>
                                    <asp:Label ID="DocDueDate" runat="server"><%#Eval("DocDueDate", "{0:dd/MM/yyyy}")%></asp:Label>
                                </td>
                                 <td>
                                    <asp:Label ID="ReqDate" runat="server"><%#Eval("ReqDate", "{0:dd/MM/yyyy}")%></asp:Label>
                                </td>

                                <td>
                                          <%--  <asp:HyperLink ID="linkItems" runat="server" Text='Edit' NavigateUrl='<%# Eval("ReqID", "StockRequisition.aspx?requestID={0}") %>' ></asp:HyperLink>--%>
                                       <asp:HyperLink ID="Edit" runat="server" Text=<%#Eval("Status", "")== "3"? "Edit":""%> NavigateUrl= '<%# "StockRequisition.aspx?requestID=" + Eval("hdrID") + "&requestStatus="+ Eval("Status") %>' ></asp:HyperLink>

                                </td>

                                 <td>
                                 <asp:LinkButton ID="imgbDelete" runat="server" CommandName="Submit" Text=<%#Eval("Status", "")== "3"? "Submit":""%>
                                                ImageUrl="~/skin/icon/delete_icon_mono.gif" OnClientClick="Dialog.showLoader();"
                                                ToolTip="Submit" />
                                               <%--showConfirmMessage(); --%>
                                               <%--return confirm('Are you sure you want to submit this requisition?');--%>
                                </td>
                                
                                 <td style="display: none">
                                    <asp:Label ID="Label1" runat="server"><%#Eval("Status")%></asp:Label>
                                </td>
                                 <td>
                                    <asp:Label ID="StatusName" runat="server"><%#Eval("Status", "") == "0" ? "Rejected" : (Eval("Status", "") == "1" ? "Approved" : (Eval("Status", "") == "3" ? "Draft" : (Eval("Status", "") == "2" ? "Pending" : Eval("Status", ""))))%></asp:Label>
                                </td>
                                <td>

                               <%--  <asp:HyperLink ID="View" runat="server" Text='View' NavigateUrl= '<%# String.Format("javascript:Main.openDialog(../Popup_Approval.aspx?requestID=" + Eval("ReqID").ToString() + ")" )%>' ></asp:HyperLink>--%>
                                          <%--  <asp:HyperLink ID="linkItems" runat="server" Text='Edit' NavigateUrl='<%# Eval("ReqID", "StockRequisition.aspx?requestID={0}") %>' ></asp:HyperLink>--%>
                                       <asp:HyperLink ID="View" runat="server" Text='View' NavigateUrl= '<%# String.Format("javascript:Main.openDialog(\"Popup_ViewApproval.aspx\",{0})", "\"requestID=" + Eval("hdrID").ToString()+"&viewMode=1" + "\"")%>' ></asp:HyperLink>
               
                                </td>
                                <td>
                                   <%-- <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl= '<%# String.Format("javascript:Main.openDialog(\"../Report/Popup_RequisitionGeneral.aspx\",{0})", "\"requestID=" + Eval("ReqID").ToString()+"&viewMode=1" + "\"")%>' >Print</asp:HyperLink>    --%>                             
                                    <asp:HyperLink ID="Print" runat="server" NavigateUrl= '<%#"javascript:printPage(\"" + Eval("ReqType") + "\", "+ Eval("hdrID") +");"%>'>Print</asp:HyperLink>                                 
                                </td>
                            </tr>
                        </ItemTemplate>
                        <EmptyDataTemplate>
                            <table class="data_table">
                                <tr>
                                <th >
                                        <span>Request ID</span>
                                    </th>
                                    <th style="display: none">
                                        <span>Requester</span>
                                    </th>
                                    <th>
                                        <span>Request Name</span>
                                    </th>
                                    <th>
                                        <span>Request Type</span>
                                    </th>
                                    <th>
                                        <span>Posting Time</span>
                                    </th>
                                    <th>
                                        <span>Valid Until</span>
                                    </th>
                                    <th>
                                        <span>Request Date</span>
                                    </th>
                                     <th>
                                        <span>Edit</span>
                                    </th>
                                    <th>
                                        <span>Submit</span>
                                    </th>
                                    
                                    <th style="display: none">
                                        <span>Status</span>
                                    </th>

                                    <th>
                                        <span>Status</span>
                                    </th>
                                    <th>
                                        <span>View</span>
                                    </th>
                                    <th>
                                        <span>Print</span>
                                    </th>
                                </tr>
                                <tr>
                                    <td colspan="11">
                                        <span>No Data</span>
                                    </td>
                                </tr>
                            </table>
                        </EmptyDataTemplate>
                    </asp:ListView>
                    
                </div>
                <div id="footer-form">
                    <div class="left">
                    </div>
                    <div class="clear">
                    </div>
                </div>
            </div>
            <div id="progressloader">
                <div id="progressloader_dialog" class="progressloader_window">
                <asp:Image ID="Image1" runat="server" Height="42" Width="42" ImageUrl="~/skin/images/ajax-loader.gif" />
                </div>
                <div id="progressloader_mask">
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
